<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %>
<script src='<s:url value="/cargodecl/js/entryDeclare_customs/entryDeclareAddContainer.js"/>'
        type='text/javascript'></script>
<script src='<s:url value="/cargodecl/js/exportDeclare_customs/exportDeclareAdd.js"/>'
        type='text/javascript'></script>
<div class="dashedbar text-cyan">
    <span>集装箱信息</span>
</div>
<div style="width:330px;float:left">
    <div>
        <div class="uploader "
             style="width:170px;background-color: #a384e9;float:left;">
            <input type="text" class="filename" style="width:64%"
                   readonly="readonly"/>
            <input type="button" name="" class="button"
                   style="width:35%;background: #a384e9;" value="选择文件"/>
            <input type="file" id="fileForBox" accept=".xls"
                   name="fileForBox" onchange="filechange(this);"/>
        </div>
        <script type="text/javascript">
            $(function () {
                $("input[type=file]").each(function () {
                    if ($(this).val() == "") {
                        $(this).parents(".uploader").find(".filename").val(
                                "没有选择文件...");
                    }
                });
            });

            function filechange(o) {
                $(o).parents(".uploader").find(".filename").val($(o).val());
            }
        </script>

        <input type="button" id="box_importButton" value="excel导入"
               style="width:60px;margin-top: 1px;background: #a384e9; margin-left:5px;"
               onclick="importContainerList()"/>
        <a style="border-bottom: 1px solid #2a6496;"
           href="<s:url value="/order/download/excel_container"/>">下载模板 </a>
    </div>

    <script type="text/javascript">
        ajaxFileUpload_BoxType = '1';
    </script>
</div>
<table id="box_input_table" class="table" width="99%" cellpadding="0"
       border="1" style="margin-bottom: 5px;">
    <tr>
        <th style="width: 84px"><span>集装箱号</span></th>
        <td colspan="2"><input type="hidden" id="box_id" style="" title="海关申报-集装箱号" class=""/>
            <input type="text" id="box_jzxh"
                   style="" title="海关申报-集装箱号" class=""
                   onchange="changeUpper(this)" name="containerNo"
                   maxlength="11"/></td>
    </tr>
    <tr>
        <th><span>集装箱规格</span></th>
        <td colspan="2">
<span class="textbox combo" style=" height: 20px;">
	 <span class="textbox-addon textbox-addon-right" style="right: 0px;">
		<a href="javascript:void(0)" onclick="initSelect($(this),null,false);"
           class="textbox-icon combo-arrow" style="width: 18px; height: 20px;"></a>
	</span>
	<input class="textbox-text validatebox-text textbox-prompt" type="text" placeholder=""
           autocomplete="off"
           style=" padding-top: 3px; padding-bottom: 3px; margin-right: 18px; margin-left: 0px;color:black;"
           id="jzxggselect_123_show" value=""
           onfocus="initByFocus($(this));"/>
</span> <input title="海关申报-集装箱规格" valueId="box_jzxgg" keyId="box_jzxggName"
               width="140px" style="display: none;" id="jzxggselect_123"
               selectData="hg_co_jzx" theKey="SHOWNAME" theValue="ID" value=""/>
            <input type="hidden" id="box_jzxgg"/>
            <input type="hidden" id="box_jzxggName" name=""/>
        </td>
    </tr>
    <tr>
        <th><span>自重(KG)</span></th>
        <td colspan="2"><input id="box_jzxzz" type="text" name=""
                               onblur="numbercheck(this,0,999999999,'',0)"
                               title="海关申报-自重" maxlength="9"/></td>
    </tr>
</table>
<ul class="add_but" style="float:right;">
    <li>
        <input class="cyan" type="button" id="box_addButton" value="添加"
               onclick="addOrUpdateBox()"/>
        <img src="<s:url value="/cargodecl/images/add.png"/>"/>
    </li>
    <li style="width:100px;">
        <span style="float:right">集装箱总数：
            <span id="boxCount">${declaration.declaContainers.size()}</span></span>
    </li>
</ul>
<div id="JZX-Content">
    <table id="JZX-table"
           width="100%" cellspacing="0" cellpadding="0" border="1"
           class="table_attach">
        <tr class="cyan">
            <th>集装箱号</th>
            <th>集装箱规格</th>
            <th style="width:15%;">自重</th>
            <th style="width:10%;">操作</th>
        </tr>
        <c:if test="${declaration.declaContainers!=null}">
            <c:forEach items="${declaration.declaContainers}" var="container" varStatus="in">
                <tr id="box_TR${in.index}" onclick="editBoxTr(${in.index})" height="22px;">
                    <td>
                        <input style="width:100%" size="10" id="box_id_${in.index}"
                               name="declaContainers[${in.index}].id" value="${container.id}"
                               type="hidden"
                               readonly="readonly">
                        <input style="width:100%" size="10" id="box_jzxh_${in.index}"
                               name="declaContainers[${in.index}].containerNo"
                               value="${container.containerNo}" readonly="readonly"
                               class="valid">
                    </td>
                    <td><input style="width:100%" size="10" id="box_jzxgg_${in.index}"
                               name="declaContainers[${in.index}].containerStandard"
                               value="${container.containerStandard}" type="hidden"
                               readonly="readonly">
                        <input style="width:100%" size="10" id="box_jzxggName_${in.index}"
                               value="<c:if test="${container.containerStandard=='S'}">海运20尺普通</c:if><c:if test="${container.containerStandard=='L'}">海运40尺普通</c:if>"
                               readonly="readonly"></td>
                    <td><input style="width:100%" size="10" id="box_jzxzz_${in.index}"
                               name="declaContainers[${in.index}].containerWeight"
                               value="${container.containerWeight}" readonly="readonly">
                    </td>
                    <td><img src="<s:url value="/cargodecl/images/delete.gif"/>"
                             onclick="delAttaTr('box_jzxh${in.index}')">
                    </td>
                </tr>
            </c:forEach>
        </c:if>
        <tr id="box_lastTR" height="22px;">
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>

    </table>
</div>
<div class="dashedbar text-soft">
    <span>随附单证信息</span>
</div>
<table id="atta_input_table"
       class="table" width="99%" cellpadding="0" border="1" style="margin-bottom: 5px;">
    <tr>
        <th>单证代码</th>
        <td>
<span class="textbox combo" style=" height: 20px;">
	 <span class="textbox-addon textbox-addon-right" style="right: 0px;">
		<a href="javascript:void(0)" onclick="initSelect($(this),null,false);"
           class="textbox-icon combo-arrow" style="width: 18px; height: 20px;"></a>
	</span>
	<input class="textbox-text validatebox-text textbox-prompt" type="text" placeholder=""
           autocomplete="off"
           style=" padding-top: 3px; padding-bottom: 3px; margin-right: 18px; margin-left: 0px;color:black;"
           id="attaSelect_show"
           onfocus="initByFocus($(this));"/>
</span>
            <input title="海关申报-随附单证代码" valueId="atta_dzdm" keyId="atta_dzdmName"
                   style="display: none;" id="attaSelect" selectData="co_bgsfdjlx"
                   theKey="SHOWNAME" theValue="ID" width="140px"/>
            <input type="hidden" id="atta_dzdm"/>
            <input type="hidden" id="atta_dzdmName" name=""/>
        </td>
    </tr>
    <tr>
        <th>单证编号</th>
        <td><input type="text" name=""
                   id="atta_dzbm" style="width: 100%" title="海关申报-随附单证编号"
                   class="{nLength:[0,32]}" maxlength="32"/></td>
    </tr>
</table>
<ul class="add_but">
    <li>
        <input type="button" id="atta_addButton" value="添加"
               onclick="addOrUpdateAtta()" class="soft"/>
        <img src="<s:url value="/cargodecl/images/add.png"/>"/>
    </li>
</ul>
<div id="SFDZ-Content">
    <table width="100%" cellspacing="0" cellpadding="0" border="1"
           class="table_attach">
        <tr class="soft">
            <th>随附单证代码</th>
            <th>单证编号</th>
            <th>操作</th>
        </tr>
        <tr id="atta_lastTR" height="0px;"></tr>
        <c:if test="${declaration.suiFuDans!=null}">
            <c:forEach items="${declaration.suiFuDans}" var="sui" varStatus="ind">
                <tr id="atta_lastTR${ind.index}" onclick="editAttaTr(${ind.index})">
                    <input style="width:100%" size="10" id="atta_dzid_${ind.index}"
                           name="suiFuDans[${ind.index}].id" value="${sui.id}"
                           type="hidden" readonly="readonly">
                    <input style="width:100%" size="10" id="atta_dzdmName_${ind.index}"
                           name="suiFuDans[${ind.index}].suifudan_co"
                           value="${sui.suifudan_co}" readonly="readonly">
                    <td>
                        <input style="width:100%" size="10" id="atta_dzdm_${ind.index}"
                               name="suiFuDans[${ind.index}].suifudan_co_cn"
                               value="${sui.suifudan_co_cn}" readonly="readonly">
                    </td>
                    <td><input style="width:100%" size="10" id="atta_dzbm_${ind.index}"
                               name="suiFuDans[${ind.index}].suifudan_no"
                               value="${sui.suifudan_no}"
                               readonly="readonly"></td>
                    <td>
                        <img src="<s:url value="/cargodecl/images/delete.gif"/>"
                             onclick="delAttaTr('atta_lastTR${ind.index}')">
                    </td>
                </tr>
            </c:forEach>
        </c:if>
        <tr id="atta_lastTR" height="22px;">
            <td></td>
            <td></td>
            <td></td>
        </tr>
    </table>
</div>
<div class="dashedbar text-blue"></div>
<table class="pn-ftable table-bordered table-condensed table">
    <tr>
        <th style="width: 84px"><span>关联报关单号</span></th>
        <td colspan="2"><input type="text" name="re_manifest"
                               style="width: 90%" title="海关申报-关联报关单号"
                               class="{anLength:[18,18]}"
                               value="${declaration.re_manifest}"/></td>
    </tr>
    <tr>
        <th><span>关联备案号</span></th>
        <td colspan="2"><input type="text" name="re_record_id"
                               style="width: 90%" title="海关申报-关联备案号"
                               class="{anLength:[12,12]}"
                               value="${declaration.re_record_id}"/></td>
    </tr>
    <tr>
        <th><span>保税/监管场所</span></th>
        <td colspan="2"><input type="text" name="re_jianguan"
                               style="width: 90%" title="海关申报-监管仓号"
                               class="{anLength:[0,32]}"
                               value="${declaration.re_jianguan}"/></td>
    </tr>
    <tr>
        <th><span>货场代码</span></th>
        <td colspan="2">
<span class="textbox combo" style=" height: 20px;">
	 <span class="textbox-addon textbox-addon-right" style="right: 0px;">
		<a href="javascript:void(0)" onclick="initSelect($(this),null,false);"
           class="textbox-icon combo-arrow" style="width: 18px; height: 20px;"></a>
	</span>
	<input class="textbox-text validatebox-text textbox-prompt" type="text" placeholder=""
           autocomplete="off"
           style=" padding-top: 3px; padding-bottom: 3px; margin-right: 18px; margin-left: 0px;color:black;"
           value="${declaration.re_yard_id}"
           title=""
           onfocus="initByFocus($(this));"/>
</span> <input id="HGSB-HCDM" title="海关申报-货场代码" name="re_yard_id"
               width="90%" style="display: none;" selectData="co_hghcdm"
               theKey="SHOWNAME" theValue="ID" value="${declaration.re_yard_id}"/></td>
    </tr>
    <tr>
        <th><span>转关提前报关</span></th>
        <td colspan="2">
            <select name="declarUp">
                <c:if test="${declaration.declarUp==0}">
                    <option value="0">正常报关</option>
                    <option value="1">转关提前报关</option>
                </c:if>
                <c:if test="${declaration.declarUp==1}">
                    <option value="1">转关提前报关</option>
                    <option value="0">正常报关</option>
                </c:if>


            </select></td>
    </tr>
    <tr>
        <td colspan="3">
            <div class="dashedbar text-blue">
                <span>其他事项确认</span>
            </div>
        </td>
    </tr>
    <tr>
        <th><span class="mustRemark">*</span>特殊关系确认</th>
        <td colspan="2">
            <select id="specialShip" onchange="changeSpacialRelation()"
                    name="special_relationship_confirm"
                    jqueryValidClass="{required:true}">
                <c:if test="${declaration.special_relationship_confirm==0}">
                    <option value="0">否</option>
                    <option value="1">是</option>
                </c:if>
                <c:if test="${declaration.special_relationship_confirm==1}">
                    <option value="1">是</option>
                    <option value="0">否</option>
                </c:if>
            </select>
        </td>
    </tr>
    <tr>
        <th><span class="mustRemark">*</span>价格影响确认</th>
        <td colspan="2">
            <select id="priceEffice" name="price_impact_confirm"
                    jqueryValidClass="{required:true}" disabled="disabled">
                <c:if test="${declaration.price_impact_confirm==0}">
                    <option value="0">否</option>
                    <option value="1">是</option>
                </c:if>
                <c:if test="${declaration.price_impact_confirm==1}">
                    <option value="1">是</option>
                    <option value="0">否</option>
                </c:if>
            </select>
        </td>
    </tr>
    <tr>
        <th><span class="mustRemark">*</span>支付特许权使用费确认</th>
        <td colspan="2">
            <select name="payment_royaltils_confirm" jqueryValidClass="{required:true}">
                <c:if test="${declaration.payment_royaltils_confirm==0}">
                    <option value="0">否</option>
                    <option value="1">是</option>
                </c:if>
                <c:if test="${declaration.payment_royaltils_confirm==1}">
                    <option value="1">是</option>
                    <option value="0">否</option>
                </c:if>
            </select>
        </td>
    </tr>
    <tr style="display:none;">
        <th><span>报关人员</span></th>
        <td colspan="2"><input type="text" name="baHgbaseinfo.bgydm"
                               value="" class="{maxlength:8}"
                               style="width: 90%" title="海关申报-报关员"/></td>
    </tr>
    <tr style="display:none;">
        <th><span>联系方式</span></th>
        <td colspan="2"><input type="text" name="baHgbaseinfo.lxfs"
                               style="width: 90%" title="海关申报-联系方式"
                               class="{maxlength:32}"
                               value=""/></td>
    </tr>
</table>


<div style="margin-left:160px;margin-top:20px;">
    <input type="radio" style="width:15px;height:15px;float: left;"
           name="is_wood_packaging"
           <c:if test="${declaration.is_wood_packaging=='有'}">checked="checked"</c:if>
           value="有"/>
    &nbsp;无木质包装声明 &nbsp;&nbsp;&nbsp;&nbsp;
    <input type="radio" style="width:15px;height:15px;"
           name="is_wood_packaging"
           <c:if test="${declaration.is_wood_packaging=='无'}">checked="checked"</c:if>
           value="无"/>
    &nbsp;木质包装声明+合格证
</div>
